package Example.Components;

import java.util.Vector;

import Example.Interfaces.UQuery;
import Example.Interfaces.USave;

public class UserData implements UQuery, USave {
	Vector users=new Vector();
	public UserData(){
		/*
		 * user information: userId(int), userPassword(String)
		 * userFirstName(String), userLastName(String),address(String) 
		 * account(Double), 
		 */
		Object[]u1={Integer.valueOf(001),"user1","yulin1","ZHANG1","Triolet,montpellier",Double.valueOf(10)};
		Object[]u2={Integer.valueOf(002),"user2","yulin2","ZHANG2","Gare,montpellier",Double.valueOf(10)};
		Object[]u3={Integer.valueOf(003),"user3","yulin3","ZHANG3","Polygone,montpellier",Double.valueOf(10)};
		users.add(u1);
		users.add(u2);
		users.add(u3);

	}
	public Object[] findAccount(int userID, String userPassword) {
		Object[] userF = null;
		for (int i = 0; i < users.size(); i++) {
			Object[]a=(Object[]) users.get(i);
			if(a[0]==Integer.valueOf(userID)&&a[1].equals(userPassword)){
				userF=a;
				return userF;
			}
		}
		return null;
		
	}

	public double storeAccount(int userID, double cost) {
		// TODO Auto-generated method stub
		return 0;
	}

}
